package com.qymerge.manage.core.bean;

import lombok.Data;
import org.codehaus.jackson.map.annotate.JsonSerialize;

import java.io.Serializable;

/**
 * Desc
 * User cong.li
 * Date 2017/4/4
 * Time 22:24
 */
@Data
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class EditorResultDTO implements Serializable {

    private boolean success;
    private String message;
    private long id;
    private String img;

    public EditorResultDTO() {
    }

    public EditorResultDTO(boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    public EditorResultDTO(boolean success, String message, Long id) {
        this.success = success;
        this.message = message;
        this.id = id;
    }

    public EditorResultDTO(boolean success, String message, Long id, String img) {
        this.success = success;
        this.message = message;
        this.id = id;
        this.img = img;
    }

    public EditorResultDTO(int rn, String successMsg, String failMsg) {
        this.success = rn > 0;
        this.message = this.isSuccess() ? successMsg : failMsg;
    }

    public EditorResultDTO(int rn, String successMsg, String failMsg, Long id) {
        this.success = rn > 0;
        this.message = this.isSuccess() ? successMsg : failMsg;
        this.id = rn > 0 ? id : 0;
    }

}
